<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql"%>


<%
      String username=(String) session.getAttribute("UserName");
	  String anform = "form";
	  String anform2 = "form";
	  if(request.getParameter("check") != null)
	  {
		  session.invalidate();
		  anform="form";
		  username= null;
		  response.sendRedirect("ManagerCategory.jsp");
	  }
		  
      if(username==null) 
      {
    	  anform="form-a";
    	  anform2 = "form-Login";
      }
      else
      {
    	  anform = "form-Login";
    	  anform2="form-a";
      }
      
%>



<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Online Shopping Center</title>
<link href="Styles.css" rel="stylesheet" />
<!-- bootstrap styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <style type="text/css">
        .label
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 11px;
         
        }
        .tableBorder
        {
            border: solid 1px #0066FF;
            margin-top: 10px;
        }
        .message
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 14px;
            font-weight: bold;
            color:White;
            text-align: left;
        }
    </style>
    <style type="text/css">
        #container
        {
            width: 800px;
            margin: auto;
            text-align: center;
        }
        .text
        {
            width: auto;
            text-align: left;
            background-color: Green;
            color: White;
            font-weight: bold;
            padding: 5px;
            clear: both;
        }
        .left
        {
            width: 200px;
            float: left;
            text-align: right;
            color: Green;
            font-size: larger;
        }
        .right
        {
            width: 550px;
            float: right;
            text-align: left;
            margin-left: 40px;
            color: Green;
            font-size: large;
        }
        #center
        {
            width: auto;
            color: Green;
            text-align: center;
        }
        .box
        {
            width: 310px;
        }
    </style>
<style>
body {
	background: lightgray;
	font-family: verdana;
	font-size: 12px;
}

#outer {
	width: 950px;
	margin: 0px auto;
}

#header {
	height: 180px;
	background-image: url("Hinh/Template/Header/header_new.png");
	width: 100%;
	background-size: 100%;
	background-repeat: no-repeat
}

#menu {
	height: 25px;
	background: aqua;
	padding-top: 5px;
	text-align: center;
}

#left {
	width: 200px;
	min-height: 600px;
	background-image: url("Hinh/Template/Left/white.jpg");
	height: auto;
	background-size: 100%;
	float: left;
}

#content {
	width: 750px;
	min-height: 600px;
	background: white;
	float: right;
}

#footer {
	height: 100px;
	background-image: url("Hinh/Template/Footer/footer_blue.png");
	background-repeat: no-repeat;
	width: 100%;
	background-size: 100%;
	clear: both;
}

#left a {
	display: block;
	padding: 5px 0px;
}
</style>

</head>
<body>

	<div id="outer">
		<div id="header"></div>
		<div id="menu">
			<a href="index.jsp">Home</a> | <a href="#">About Us</a> | <a
				href="#">Contact Us</a> | <a href="#">Feedback</a>
			| <a href="#">FAQs</a> 
		</div>
		<div id="left">
			<fieldset>
				<form class=<%=anform%> action="CheckLogin" method="post" >
	    					Username: <input type="text" name="txtUserName" class="input-medium UserName-query">
	    					PassWord:<input type="password" name="txtPassword" class="input-medium PassWord-query">
	    					<input type="submit" name="btnLogin" class="btn" value="Login">
	    				</form>
	    			
	    			<form class=<%=anform2 %> action="?check=1" method="post" >
	    					Welcome: <font color="blue"><strong><%=username%> </strong></font>
	    					<input type="submit" name="btnlogout" class="btn" value="Logout">
	    				</form>		 
			
				<%-- <tiles:insertAttribute name="head" />--%>
			</fieldset>
			<fieldset>
				<legend align="center">Vertical Menu</legend>
				<nav id="menu2">
					<ul>
						<li><a href="index.jsp">Home</a></li>
						<li><a href="#">Categories</a>
							<ul>
								<!-- câu lệnh truy vấn -->
								<sql:query var="result">
										SELECT * FROM Categories
										 
								</sql:query>
									
									
								<c:forEach var="c" items="${result.rows}">
									<li><a href="Product.do?cate_id=${c.Id}">${c.Name}</a></li>
								</c:forEach>

							</ul></li>
						<li><a href="#">Manager</a>
							<ul>
								<li><a href="ManagerCustomer.jsp">Customer</a></li>
								<li><a href="ManagerCategory.jsp">Categories</a></li>
								<li><a href="ManagerProduct.jsp">Products</a>
								<li><a href="ManagerOrders.jsp">Orders</a>
							</ul></li>
						<li><a href="#">Feedback</a></li>
						<li><a href="#">FAQs</a></li>
					</ul>
				</nav>
			</fieldset>
		</div>
		<div id="content">
			<tiles:insertAttribute name="body" />
		</div>
		<div id="footer" >
		<br>
		<h5 align="center"><font color="white" ><strong>Nguyễn Thị Ngọc Anh - Lê Kim Dũng - Nguyễn Thế Thông - Huỳnh Thanh Tiến</font></strong></h3>
		</div>
	</div>

</body>
</html>
